import React from 'react';
import {Form, message, Modal} from "antd";
import ProForm, {ProFormRadio, ProFormText, ProFormTextArea} from "@ant-design/pro-form";
import {Addsystem} from "@/services/ant-design-pro/management";

const AddMuoban = (props) => {
  const {AddMuoban,Muoban,Formlist} = props;
  const [form] = Form.useForm()
  return (
    <Modal
      visible={AddMuoban}
      onCancel={() => {
        Muoban(false)
      }}
      footer={false}
    >
      <ProForm
        form={form}
        visible={Muoban}
        modalProps={ {
          onChange:()=>{Muoban(false)}
        } }
        onFinish={async (value) => {
          await Addsystem({...value})
          console.log(value);
          message.success('添加成功');
          Formlist(value)
          return Muoban(false);
        }}

      >
        <ProFormText
          name="template_key"
          label="模板编号："
          placeholder="模板编号"
        />
        <ProFormText
          name="name"
          label="模板名："
          placeholder="模板名"
        />
        <ProFormText
          name="template_id"
          label="模板ID："
          placeholder="模板ID"
        />
        <ProFormTextArea
          name="content"
          label="回复内容"
          placeholder="回复内容"
        />
        <ProFormRadio.Group
          name="status"
          label="状态:"
          initialValue={2}
          options={[
            {
              label: '开启',
              value: 1,
            },
            {
              label: '关闭',
              value: 2,
            },
          ]}
        />
      </ProForm>
    </Modal>
  );
};

export default AddMuoban;
